package com.yun.routing.direct;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.yun.utils.ConnectionUtil;
import org.junit.Test;

import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class Provider {
    private static final String EXCHANGE_NAME = "direct_logs";

    @Test
    public void provider() throws IOException {
        Connection connection = ConnectionUtil.getConnection();
        Channel channel = connection.createChannel();

        channel.exchangeDeclare(EXCHANGE_NAME,"direct");


        channel.basicPublish(EXCHANGE_NAME,"error",null,"error错误日志".getBytes(StandardCharsets.UTF_8));
        channel.basicPublish(EXCHANGE_NAME,"info",null,"info日志".getBytes(StandardCharsets.UTF_8));
        channel.basicPublish(EXCHANGE_NAME,"warning",null,"warning警告日志".getBytes(StandardCharsets.UTF_8));

    }
}
